home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17937 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: nntp1.best.com!donstarr
  2. From: super@donstarr.org (Don Starr)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: sizeof() question >>> :)
  5. Date: Thu, 18 Apr 96 04:14:12 GMT
  6. Organization: Best Internet Communications
  7. Message-ID: <4l4fik$1a8_005@donstarr.best.com>
  8. References: <1996Apr12.061927@topaz> <31714828.1574068@news.linex.com> <4l0dcr$14t0@darwin.nbnet.nb.ca> <danpop.829678939@news.cern.ch>
  9. NNTP-Posting-Host: donstarr.vip.best.com
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <danpop.829678939@news.cern.ch>,
  13.    danpop@mail.cern.ch (Dan Pop) wrote:
  14. *>
  15. *> If you allocate the space for the array you can call one of the memory
  16. *> routines which return the size of the allocation.
  17. *> Dave Gaudet via Rick Bruce
  18. *
  19. *There is no such "routine" in the C language.
  20. *
  21. *Dan
  22.  
  23. Technically, there is no such _any_ routine in the C language. The language 
  24. doesn't define any functions - "standard" libraries do.
  25.  
  26. As to the original question, if you know how your heap is structured (from 
  27. the source to your malloc(), new, or whatever), you can get the size of any 
  28. allocation from it.
  29.  
  30. Don
  31.